﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Raven.Client;

namespace SportsStore.DataBaseInfrastructure
{
    public class RavenSession : ISession
    {
        private readonly IDocumentStore documentStore;
        public RavenSession(IDocumentStore databaseStore)
        {
            if (databaseStore == null)
                throw new ArgumentNullException();
            documentStore = databaseStore;
        }
        public IDocumentSession OpenSession()
        {
            try
            {
                return documentStore.OpenSession();
            }
            catch (Exception ex)
            {
                return null;
            }
        }
    }
}
